package com.sllx.userManage.action;

import com.sllx.core.action.BaseAction;
import com.sllx.userManage.entity.User;
import com.sllx.userManage.service.UserService;





public class HomeAction extends BaseAction{
	
	private static final long serialVersionUID = 6749907487524754845L;
	private User user;
	private UserService userService;
	public String checkUserIfExists(){
		boolean exists = userService.exists(user);
		request.setAttribute("message", exists);
		out.print(exists);
		return null;
	}

	public String addUser() {
		userService.addUser(user);
		request.setAttribute("message", "添加成功");
		return SUCCESS;
	}
	
	public String findUsers() {
		request.setAttribute("userList", userService.findUsers());
		return SUCCESS;
	}
	
	public String deleteUser(){
		user.setUserName("name");
		user.setUserAge(1);
		userService.deleteUser(user);
		out.print("success");
		return null;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}


	
	
	
}
